<!DOCTYPE html>
<html>
<head>
  <title><%= content_for?(:page_title) ? (yield(:page_title) + '') : 'Blog' %></title>
  <%= csrf_meta_tags %>

  <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
  <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
</head>

<body>
<div class="default-theme">
  <div class="header">
    <nav class="navbar navbar-default" role="navigation">
      <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="/">Blog</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-navbar-collapse">
          <ul class="nav navbar-nav navbar-right">
            <form class="navbar-form navbar-left" role="search">
              <div class="form-group">
                <input type="text" class="form-control" placeholder="Search">
              </div>
            </form>
            <% if user_signed_in? %>
              <li><a href="/posts">文章</a></li>
              <li><a href="/photos">相册</a></li>
              <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown"><%= current_user.username %>
                  <span class="caret"></span></a>
                <ul class="dropdown-menu" role="menu">
                  <li>
                    <%= link_to('Logout', destroy_user_session_path, method: :delete) %>
                  </li>
                  <li class="divider"></li>
                  <li><%= link_to('Change pass', edit_user_registration_path) %></li>
                </ul>
              </li>
            <% else %>
              <li><%= link_to('Login', new_user_session_path)  %> </li>
            <% end %>
          </ul>
        </div><!-- /.navbar-collapse -->
      </div><!-- /.container-fluid -->
    </nav>
  </div>
  <div class="main container-fluid">
    <div class="row">
      <p class="notice"><%= notice %></p>
      <p class="alert"><%= alert %></p>
      <%= yield %>
    </div>
  </div>
  <div class="footer"></div>
</div>
</body>
</html>
